//@HERRICK ONG ZHI PING A0099371U

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "logic.h"
#include "logicreply.h"
#include "Logger.h"
#include "Utility.h"

#define INITIALIZE_CORRUPTED "Welcome. The following data has been corrupted from the previous session"
#define INITIALIZE_NOURGENT "Welcome. You have no urgent tasks from the previous session."
#define INITIALIZE_URGENT "Welcome. These are the urgent tasks from the previous session."

#define COMMAND_DISPLAY "display"
#define COMMAND_ADD "add"
#define COMMAND_DELETE "delete"
#define COMMAND_COMPLETE "complete"
#define COMMAND_MODIFY "modify"
#define COMMAND_SEARCH "search"
#define COMMAND_DATE "date "
#define COMMAND_STARTTIME "starttime "
#define COMMAND_ENDTIME "endtime "
#define COMMAND_TITLE "title "

#define DELIMITER_SLASH "/"
#define WHITESPACE " "

#define FEEDBACK_ADD "Add format: (title) / (date) / (start time) / (end time)."
#define FEEDBACK_DATE "Input Date. Acceptable date formats are: 1204, 12 Apr, today/tomorrow, next tuesday."
#define FEEDBACK_TIME "Input Time. Acceptable time formats are: 1830, 630pm, 6.30pm."
#define FEEDBACK_DELIMITERS "Too many delimiters."
#define FEEDBACK_DELETE "Delete format: (keyword)."
#define FEEDBACK_MODIFY "Modify format: (keyword)."
#define FEEDBACK_DISPLAY "Display format: Floating/Deadline/Meeting/All/Overdue/Urgent/Date."
#define FEEDBACK_COMPLETE "Complete format: (keyword)."
#define FEEDBACK_SEARCH "Search format: (keyword)."

#define FEEDBACK_MODIFYFORMAT "Modify format: (Task Number) (component to change) (modifications)."
#define FEEDBACK_MODIFYCOMPONENTS "Components: title / date / starttime / endtime."
#define FEEDBACK_MODIFYTITLE "Type your new title."

#define FEEDBACK_ERROR "An error has occurred in input. Please input a new command."

using namespace std;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    LogicReply::SignalType currentSignal;

    string dataEntry, result;
    QString dataEntryQ, resultQ;
    QVector<Task> TaskList;
    Logic officeLogic;
    LogicReply logicResult;
    Utility digitChecker;
    Logger GUILogger;
	int TaskNum;

    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void initializeSession();
    void displayCorruptStrings(QVector<QString> corruptStrings);

    void executeInput();
    void parseSignal();
    void changeSignal();
    void displayFeedback();

    void executeTaskDirect();

    void refreshDisplay();
    void toggleHide();
    void clearWidgets();
    void displayAllOutput();
    void displayStandardOutput(QVector<Task> TaskList);
    void displayDateOutput(QVector<Task> TaskList);

    void updateStatusOnWidget(Task::TaskStatus, int index);

    void hideAllWidgets();
    void hideDateWidgets();
    void hideStandardWidgets();
    void hideMeetingWidgets();
    void hideDeadlineWidgets();

    void showMeetingWidgets();
    void showDeadlineWidgets();
    void showStandardWidgets();
    void showDateWidgets();

    void adjustDeadlineSize();

    void fadeAnimation();

    void parseText(const QString &arg1);
    void parseText_None(const QString &arg1);
    void parseText_Modify(const QString &arg1);

	//Stubs for integration testing
	QString executeInputTest(QString command);

private slots:

    void on_inputBar_returnPressed();

    void on_inputBar_textEdited(const QString &arg1);

protected:

    void mousePressEvent(QMouseEvent *evt);

    void mouseMoveEvent(QMouseEvent *evt);

    QPoint oldPos;

    bool isHidden;

private:
    Ui::MainWindow *ui;




};

#endif // MAINWINDOW_H
